﻿using Framework;
using Game.View;
using UnityEngine;

namespace Game.State
{
    /// <summary>
    /// 标题场景状态
    /// </summary>
    public class Title : Framework.SceneManager.ISceneState
    {
        /// <summary>
        /// 标题视图
        /// </summary>
        private TitleView _TitleView;
        
        public void OnLoad()
        {
            _TitleView = this.LoadView<TitleView>();
        }

        public void OnEnter(RectTransform sceneRoot)
        {
            _TitleView.transform.SetParent(sceneRoot, false);
        }

        public void OnExit(RectTransform sceneRoot)
        {
            Object.Destroy(_TitleView.gameObject);
        }
    }
}